<template>
    <div>
        <div class="header">
            <div class="title"></div>
        </div>
        <div class="information">
            <div class="variation">
                <div class="box">
                    <div class="variationTit" @click="home">重点关注-主变</div>
                    <div v-for="(item, index) in loadData" :key="index" class="yop">
                        <span class="name">{{ item.name }}</span>
                        <span class="unit">{{ item.unit }}</span>
                        <div class="text">{{ item.text }}</div>
                    </div>
                </div>
            </div>
            <div class="environment">
                <div class="box">
                    <div class="variationTit">环境信息</div>
                    <div class="contBox">
                        <div style="display: flex;align-items: center;margin-top: -10px">
                            <div class="temperature" :style="{ backgroundImage: 'url(' + tempImage + ')' }"></div>
                            <div>
                                <span class="name">18.6</span>
                                <span class="unit">℃</span>
                                <div class="text">环境温度</div>
                            </div>
                        </div>
                        <div style="display: flex;align-items: center;">
                            <div class="temperature1" :style="{ backgroundImage: 'url(' + wetImage + ')' }"></div>
                            <div style="margin-left: 6px;">
                                <span class="name">53</span>
                                <span class="unit">RH</span>
                                <div class="text">环境湿度</div>
                            </div>
                        </div>
                        <div style="display: flex;align-items: center;">
                            <div class="temperature2" :style="{ backgroundImage: 'url(' + stressImage + ')' }"></div>
                            <div style="margin-left: 6px;">
                                <span class="name">96.4</span>
                                <span class="unit">kPa</span>
                                <div class="text">大气压力</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="buttonBox">
            <div class="station" @click="goToDa">
                <div class="da"></div>
            </div>
            <div class="station" @click="goToIndex">
                <div class="stationIcon"></div>
            </div>
            <div class="station" @click="goToAAA">
                <div class="equipmentIcon"></div>
            </div>
        </div>
    </div>
</template>

<script setup>
import {ref} from "vue";
import {useRouter} from 'vue-router'
import tempImage from "../../assets/images/Vector1.png";
import wetImage from "../../assets/images/Group1.png";
import stressImage from "../../assets/images/Vector2.png";
import {sendToUeMsg} from "@/utils/UeMessageUtils";

const router = useRouter()
const goToIndex = () => {
    sendToUeMsg({
        type: 'overall',
    })
    router.push('/phone');
};
const goToAAA = () => {
    sendToUeMsg({
        principal : '1',
    })
    router.push('/find');
};
const home = () =>{
    router.push('/');
}
const goToDa = () => {
    const el = document.documentElement;
    if (!document.fullscreenElement && !document.mozFullScreenElement &&
        !document.webkitFullscreenElement && !document.msFullscreenElement) {
        if (el.requestFullscreen) {
            el.requestFullscreen();
        } else if (el.msRequestFullscreen) {
            el.msRequestFullscreen();
        } else if (el.mozRequestFullScreen) {
            el.mozRequestFullScreen();
        } else if (el.webkitRequestFullscreen) {
            el.webkitRequestFullscreen();
        }
    } else {
        if (document.exitFullscreen) {
            document.exitFullscreen();
        } else if (document.msExitFullscreen) {
            document.msExitFullscreen();
        } else if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen();
        } else if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen();
        }
    }
};

const loadData = ref([
    {
        name: "2.409",
        unit: 'mw',
        text: "实时负荷",
    },
    {
        name: "37.59",
        unit: '℃',
        text: "实时油温",
    },
    {
        name: "49.0",
        unit: 'mw',
        text: "额定容量",
    },
    {
        name: "4.81",
        unit: '%',
        text: "负载率",
    },
]);
const envData = ref([
    {
        url: tempImage,
        name: "18.6",
        unit: "℃",
        text: "环境温度",
    },
    {
        url: wetImage,
        name: "53",
        unit: "RH",
        text: "环境湿度",
    },
    {
        url: stressImage,
        name: "96.400",
        unit: 'kPa',
        text: "大气压力",
    },
]);
</script>

<style scoped lang="scss">
//.header {
//  width: 100vw;
//  height: 44px;
//  background: rgba(0, 0, 0, 0.6);
//  box-shadow: 0px 4px 9px 0px rgba(0, 192, 255, 0.15);
//  display: grid;
//  place-items: center;
//  pointer-events: all;
//
//  .title {
//    width: 264px;
//    height: 16px;
//    background-image: url("../../assets/images/title.png");
//    background-size: 100% 100%;
//  }
//}

.information {
  width: 683px;
  height: 663px;
  //background-color: #00AEBF;
  margin: 61px 0 0 26px;
  display: flex;
  justify-content: space-between;
  pointer-events: all;

  .variation {
    width: 325px;
    height: 662px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 35px 35px 35px 35px;
    // text-align: center;
    .box {
      width: 257px;
      height: 584px !important;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      margin: 29px 0 0 34px;

      .yop {
        margin-top: -15px;
      }
    }

    .variationTit {
      font-size: 39px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 500;
      color: #FFFFFF;
      text-align: center;
      //margin-top: 29px;
    }

    .name {
      font-size: 46px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: #FFFFFF;

    }

    .unit {
      font-size: 35px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.7);
      margin-left: 6px;
    }

    .text {
      //height: 20px;
      //line-height: 20px;
      font-size: 22px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.7);
      margin-top: -15px;

    }
  }

  .environment {
    width: 325px;
    height: 564px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 35px 35px 35px 35px;

    .box {
      width: 273px;
      height: 490px;
      margin: 29px 0 0 37px;

    }

    .variationTit {
      font-size: 40px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 500;
      color: #FFFFFF;
    }

    .contBox {
      width: 273px;
      height: 400px;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      margin-top: 11px;

    }

    .temperature {
      width: 37px;
      height: 63px;
      background-size: 100% 100%;
      margin-right: 20px;
      margin-top: 60px;
    }

    .temperature1 {
      width: 43.5px;
      height: 55px;
      background-size: 100% 100%;
      margin-right: 10px;
      margin-top: 60px;
    }

    .temperature2 {
      width: 55.4px;
      height: 44px;
      background-size: 100% 100%;
      margin-right: 10px;
      margin-top: 60px;
    }

    .name {
      font-size: 46px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: #FFFFFF;
    }

    .unit {
      font-size: 35px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.7);
    }

    .text {
      height: 30px;
      line-height: 30px;
      font-size: 35px;
      font-family: Noto Sans SC, Noto Sans SC;
      font-weight: 400;
      color: rgba(255, 255, 255, 0.7);
    }
  }
}

.buttonBox {
  width: 128px;
  height: 464px;
  position: fixed;
  right: 40px;
  bottom: 37px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: all;

  .station {
    width: 127px;
    height: 127px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 35px 35px 35px 35px;
    display: flex;
    align-items: center;
    justify-content: center;

    .stationIcon {
      width: 64px;
      height: 64px;
      background-image: url("../../assets/images/icon1.png");
      background-size: 100% 100%;
      margin-top: 15px;

    }

    .equipmentIcon {
      width: 64px;
      height: 64px;
      background-image: url("../../assets/images/Vector.png");
      background-size: 100% 100%;
      margin-top: 15px;
    }

    .da {
      width: 64px;
      height: 64px;
      background-image: url("../../assets/images/ss.png");
      background-size: 100% 100%;
      margin-top: 4px;
    }
  }
}
</style>